namespace Digitalmes.Common.Exceptions;

/// <summary>
/// 表示为业务异常。
/// </summary>
public class BusinessException(int? code = null,
    string? message = null,
    string? details = null,
    Exception? innerException = null) : Exception(message, innerException)
{
    public int? Code { get; set; } = code;

    public string? Details { get; set; } = details;

    public BusinessException WithData(string name, object value)
    {
        Data[name] = value;
        return this;
    }
}
